package com.neucloud.da.edgeside.config;

import com.neucloud.da.edgeside.filter.ApiSignFilter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
    @Resource
    ApiSignFilter apiSignFilter;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        //不拦截的地址
        List<String> excludedList = new ArrayList<>();
        excludedList.add("/getSecret");



        registry.addInterceptor(apiSignFilter)
                .addPathPatterns("/**")
                .excludePathPatterns(excludedList);
        super.addInterceptors(registry);
    }
}
